package cn.graydove.bot.config;

import cn.graydove.bot.core.ProcessorManager;
import cn.graydove.bot.mirai.Robot;
import cn.graydove.bot.support.BotProperties;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Slf4j
@Configuration
public class MiraiConfig {

    private BotProperties botProperties;


    public MiraiConfig(BotProperties botProperties) {
        this.botProperties = botProperties;
    }


    @Bean
    public ProcessorManager processor() {
        return new ProcessorManager();
    }

    @Bean
    public Robot robot() {

        log.info("登录QQ：{}", botProperties.getBotQq());
        Robot robot = new Robot(botProperties, processor());
        robot.start();
        return robot;
    }
}
